home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / libx11inc.lha / X11 / Xm / LabelGP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-13  |  10.0 KB  |  300 lines

  1. /* 
  2.  * (c) Copyright 1989, 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC.
  3.  * ALL RIGHTS RESERVED
  4. */ 
  5. /*   $RCSfile: LabelGP.h,v $ $Revision: 1.21 $ $Date: 92/07/06 14:49:53 $ */
  6. /*
  7. *  (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  8. /*
  9. *  (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  10. #ifndef _XmLabelGP_h
  11. #define _XmLabelGP_h
  12.  
  13. #include <Xm/LabelG.h>
  14. #include <Xm/GadgetP.h>
  15. #include <Xm/ExtObjectP.h>
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. /*************************************************************/
  22. /* The Label Gadget Cache Object's class and instance records*/
  23. /*************************************************************/
  24.  
  25.  
  26. typedef struct _XmLabelGCacheObjClassPart
  27. {
  28.     int foo;
  29. } XmLabelGCacheObjClassPart;
  30.  
  31.  
  32. typedef struct _XmLabelGCacheObjClassRec     /* label cache class record */
  33. {
  34.     ObjectClassPart            object_class;
  35.     XmExtClassPart                     ext_class;
  36.     XmLabelGCacheObjClassPart         label_class_cache;
  37. } XmLabelGCacheObjClassRec;
  38.  
  39. externalref XmLabelGCacheObjClassRec xmLabelGCacheObjClassRec;
  40.  
  41.  
  42. /*  The Label Gadget Cache instance record  */
  43.  
  44. typedef struct _XmLabelGCacheObjPart
  45. {
  46.         unsigned char    label_type;
  47.         unsigned char    alignment;
  48.         unsigned char    string_direction;
  49.     
  50.     Dimension    margin_height;   /* margin around widget */
  51.     Dimension    margin_width;
  52.  
  53.     Dimension    margin_left;    /* additional margins on */
  54.     Dimension    margin_right;   /* each side of widget */
  55.     Dimension    margin_top;     /* text (or pixmap) is placed */
  56.     Dimension    margin_bottom;  /* inside the margins */
  57.  
  58.     Boolean recompute_size;
  59.  
  60.     Boolean        skipCallback; /* set by RowColumn when entryCallback
  61.                     is provided. */
  62.     unsigned char   menu_type;
  63. } XmLabelGCacheObjPart;
  64.  
  65. typedef struct _XmLabelGCacheObjRec
  66. {
  67.     ObjectPart               object;
  68.     XmExtPart                 ext;
  69.     XmLabelGCacheObjPart     label_cache;
  70. } XmLabelGCacheObjRec;
  71.  
  72. /*  The Label Widget Class and instance records  */
  73. /*************************************************/
  74.  
  75. typedef struct _XmLabelGadgetClassPart     /* label class record */
  76. {
  77.         XtWidgetProc        setOverrideCallback;
  78.     XmMenuProc        menuProcs;
  79.         XtPointer            extension; /* Pointer to extension record */
  80. } XmLabelGadgetClassPart;
  81.  
  82. typedef struct _XmLabelGadgetClassRec
  83. {
  84.     RectObjClassPart       rect_class;
  85.     XmGadgetClassPart      gadget_class;
  86.     XmLabelGadgetClassPart label_class;
  87. } XmLabelGadgetClassRec;
  88.  
  89. externalref XmLabelGadgetClassRec xmLabelGadgetClassRec;
  90.  
  91. typedef struct _XmLabelGadgetPart
  92. {
  93.     _XmString    _label;  /* String sent to this widget */
  94.         _XmString       _acc_text;
  95.         KeySym            mnemonic;
  96.     XmStringCharSet mnemonicCharset;
  97.         char         *accelerator;
  98.         XmFontList    font;
  99.  
  100.         Pixmap        pixmap; 
  101.         Pixmap        pixmap_insen; 
  102.  
  103.         /* PRIVATE members -- values computed by LabelWidgetClass methods */
  104.  
  105.         GC        normal_GC;   /* GC for text */    
  106.     GC        insensitive_GC;
  107.         XRectangle    TextRect;    /* The bounding box of the text, or clip
  108.                                         rectangle of the window; whichever is
  109.                                         smaller */
  110.         XRectangle    acc_TextRect; /* The bounding box of the text, or clip
  111.                                         rectangle of the window; whichever is
  112.                                         smaller */
  113.  
  114.     XmLabelGCacheObjPart *cache;
  115.  
  116. } XmLabelGadgetPart;
  117.  
  118.  
  119. typedef struct _XmLabelGadgetRec
  120. {
  121.    ObjectPart        object;
  122.    RectObjPart       rectangle;
  123.    XmGadgetPart      gadget;
  124.    XmLabelGadgetPart label;
  125. } XmLabelGadgetRec;
  126.  
  127. /* Inherited  Functions exported by label */
  128.  
  129. #define XmInheritSetOverrideCallback ((XtWidgetProc) _XtInherit)
  130. #define XmInheritResize  ((XtWidgetProc) _XtInherit)
  131.  
  132. /* Padding between label text and accelerator text */
  133.  
  134. #define LABELG_ACC_PAD        15
  135.  
  136. /* MACROS */
  137. /********
  138.  * Macros for cached instance fields
  139.  */
  140. #define LabG_LabelType(w)        (((XmLabelGadget)(w)) -> \
  141.                        label.cache-> label_type)
  142. #define LabG_Alignment(w)        (((XmLabelGadget)(w)) -> \
  143.                        label.cache-> alignment)
  144. #define LabG_StringDirection(w)        (((XmLabelGadget)(w)) -> \
  145.                        label.cache-> string_direction)
  146. #define LabG_MarginHeight(w)        (((XmLabelGadget)(w)) -> \
  147.                                            label.cache-> margin_height)
  148. #define LabG_MarginWidth(w)        (((XmLabelGadget)(w)) -> \
  149.                                            label.cache-> margin_width)
  150. #define LabG_MarginLeft(w)        (((XmLabelGadget)(w)) -> \
  151.                                            label.cache-> margin_left)
  152. #define LabG_MarginRight(w)        (((XmLabelGadget)(w)) -> \
  153.                                            label.cache-> margin_right)
  154. #define LabG_MarginTop(w)        (((XmLabelGadget)(w)) -> \
  155.                                            label.cache-> margin_top)
  156. #define LabG_MarginBottom(w)        (((XmLabelGadget)(w)) -> \
  157.                                            label.cache-> margin_bottom)
  158. #define LabG_RecomputeSize(w)        (((XmLabelGadget)(w)) -> \
  159.                                            label.cache-> recompute_size)
  160. #define LabG_SkipCallback(w)        (((XmLabelGadget)(w)) -> \
  161.                                            label.cache-> skipCallback)
  162. #define LabG_MenuType(w)        (((XmLabelGadget)(w)) -> \
  163.                                            label.cache-> menu_type)
  164. /********
  165.  * Macros for UNcached instance fields
  166.  */
  167. #define LabG__label(w)            (((XmLabelGadget)(w)) -> \
  168.                        label._label)
  169. #define LabG__acceleratorText(w)    (((XmLabelGadget)(w)) -> \
  170.                                            label._acc_text)
  171. #define LabG_Font(w)            (((XmLabelGadget)(w)) -> \
  172.                        label.font)
  173. #define LabG_Mnemonic(w)        (((XmLabelGadget)(w)) -> \
  174.                        label.mnemonic)
  175. #define LabG_MnemonicCharset(w)         (((XmLabelGadget)(w)) -> \
  176.                                            label.mnemonicCharset)
  177. #define LabG_Accelerator(w)        (((XmLabelGadget)(w)) -> \
  178.                                            label.accelerator)
  179. #define LabG_Pixmap(w)            (((XmLabelGadget)(w)) -> \
  180.                                            label.pixmap)
  181. #define LabG_PixmapInsensitive(w)    (((XmLabelGadget)(w)) -> \
  182.                                            label.pixmap_insen)
  183. #define LabG_NormalGC(w)        (((XmLabelGadget)(w)) -> \
  184.                                            label.normal_GC)
  185. #define LabG_InsensitiveGC(w)        (((XmLabelGadget)(w)) -> \
  186.                                            label.insensitive_GC)
  187. #define LabG_TextRect(w)        (((XmLabelGadget)(w)) -> \
  188.                                            label.TextRect)
  189. #define LabG_AccTextRect(w)        (((XmLabelGadget)(w)) -> \
  190.                                            label.acc_TextRect)
  191.  
  192.  
  193. /********
  194.  * Convenience Macros 
  195.  */
  196. #define LabG_TextRect_x(w)        (LabG_TextRect(w).x)
  197.                                            
  198. #define LabG_TextRect_y(w)        (LabG_TextRect(w).y)
  199.                                            
  200. #define LabG_TextRect_width(w)        (LabG_TextRect(w).width)
  201.                                            
  202. #define LabG_TextRect_height(w)        (LabG_TextRect(w).height)
  203.                                            
  204. #define LabG_IsText(w)            (LabG_LabelType(w) == XmSTRING)
  205.  
  206. #define LabG_IsPixmap(w)        (LabG_LabelType(w) == XmPIXMAP)
  207.  
  208. #define LabG_Cache(w)            (((XmLabelGadget)(w))-> \
  209.                        label.cache)
  210. #define LabG_Shadow(w)                   (((XmLabelGadget)(w))->gadget.shadow_thickness)
  211. #define LabG_Highlight(w)                (((XmLabelGadget)(w))->gadget.highlight_thickness)
  212. #define LabG_Baseline(w)                 (_XmStringBaseline ( \
  213.                                          ((XmLabelGadget)(w))->label.font,\
  214.                                          ((XmLabelGadget)(w))->label._label))
  215. #define LabG_ClassCachePart(w) \
  216.     (((XmLabelGadgetClass)xmLabelGadgetClass)->gadget_class.cache_part)
  217.  
  218.  
  219. /********    Private Function Declarations    ********/
  220. #ifdef _NO_PROTO
  221.  
  222. extern int _XmLabelCacheCompare() ;
  223. extern void _XmCalcLabelGDimensions() ;
  224. extern void _XmReCacheLabG() ;
  225. extern void _XmAssignLabG_MarginHeight() ;
  226. extern void _XmAssignLabG_MarginWidth() ;
  227. extern void _XmAssignLabG_MarginLeft() ;
  228. extern void _XmAssignLabG_MarginRight() ;
  229. extern void _XmAssignLabG_MarginTop() ;
  230. extern void _XmAssignLabG_MarginBottom() ;
  231. extern void _XmProcessDrag() ;
  232.  
  233. #else
  234.  
  235. extern int _XmLabelCacheCompare( 
  236.                         XtPointer A,
  237.                         XtPointer B) ;
  238. extern void _XmCalcLabelGDimensions( 
  239.                         Widget wid) ;
  240. extern void _XmReCacheLabG( 
  241.                         Widget wid) ;
  242. extern void _XmAssignLabG_MarginHeight( 
  243.                         XmLabelGadget lw,
  244. #if NeedWidePrototypes
  245.                         int value) ;
  246. #else
  247.                         Dimension value) ;
  248. #endif /* NeedWidePrototypes */
  249. extern void _XmAssignLabG_MarginWidth( 
  250.                         XmLabelGadget lw,
  251. #if NeedWidePrototypes
  252.                         int value) ;
  253. #else
  254.                         Dimension value) ;
  255. #endif /* NeedWidePrototypes */
  256. extern void _XmAssignLabG_MarginLeft( 
  257.                         XmLabelGadget lw,
  258. #if NeedWidePrototypes
  259.                         int value) ;
  260. #else
  261.                         Dimension value) ;
  262. #endif /* NeedWidePrototypes */
  263. extern void _XmAssignLabG_MarginRight( 
  264.                         XmLabelGadget lw,
  265. #if NeedWidePrototypes
  266.                         int value) ;
  267. #else
  268.                         Dimension value) ;
  269. #endif /* NeedWidePrototypes */
  270. extern void _XmAssignLabG_MarginTop( 
  271.                         XmLabelGadget lw,
  272. #if NeedWidePrototypes
  273.                         int value) ;
  274. #else
  275.                         Dimension value) ;
  276. #endif /* NeedWidePrototypes */
  277. extern void _XmAssignLabG_MarginBottom( 
  278.                         XmLabelGadget lw,
  279. #if NeedWidePrototypes
  280.                         int value) ;
  281. #else
  282.                         Dimension value) ;
  283. #endif /* NeedWidePrototypes */
  284. extern void _XmProcessDrag( 
  285.                         Widget w,
  286.                         XEvent *event,
  287.                         String *params,
  288.                         Cardinal *num_params) ;
  289.  
  290. #endif /* _NO_PROTO */
  291. /********    End Private Function Declarations    ********/
  292.  
  293.  
  294. #ifdef __cplusplus
  295. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  296. #endif
  297.  
  298. #endif /* _XmLabelGP_h */
  299. /* DON'T ADD ANYTHING AFTER THIS #endif */
  300.